package com.practice.security;

import java.io.File;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;

import com.practice.security.rsa.RSAKeyHelper;

public class RSAPractice {
	
	private static final String PUBLIC_KEY_FILE_PATH = "C:\\Users\\lex.c.chen\\Documents\\Authorize\\OpenSSL\\public.pem";
	
	private static final String PRIVATE_KEY_FILE_PATH = "C:\\Users\\lex.c.chen\\Documents\\Authorize\\OpenSSL\\private.pkcs8.key";

	public static void main(String[] args) throws Exception {
		
		RSAKeyHelper rsaKeyHelper = new RSAKeyHelper();
		
		RSAPublicKey publicKey = rsaKeyHelper.readPublicKey(new File(PUBLIC_KEY_FILE_PATH));
		System.out.println(publicKey.getModulus());
		
		RSAPrivateKey privateKey = rsaKeyHelper.readPrivateKey(new File(PRIVATE_KEY_FILE_PATH));
		System.out.println(privateKey.getPrivateExponent());
		
	}
	
}
